#ifndef TOOL_CAPTRUE_H
#define TOOL_CAPTRUE_H

#include <QObject>
#include <QCamera>
#include <QImage>
#include <QCameraImageCapture>

class Tool_captrue : public QObject
{
    Q_OBJECT
    //Qt属性，与QML对象属性类似
    Q_PROPERTY( QObject* qmlCamera READ getQmlCamera WRITE setQmlCamera )
public:
    explicit Tool_captrue(QObject *parent = nullptr);

    //获取类的属性, 返回_qmlCamera对象
    QObject *getQmlCamera() const;

    //设置类的属性qmlCamera, 传入QML对象Camera，然后将_qmlCamera设置为qmlCamera
    void setQmlCamera( QObject *qmlCamera );

signals:
    void getCaptrueImage(QImage img);
private:
    //从QML获取到的Camera对象
    QObject *m_qmlCamera = nullptr;

    //在C++中的QCamera对象
    QCamera *m_camera = nullptr;

    QCameraImageCapture *m_captrue=nullptr;

};

#endif // TOOL_CAPTRUE_H
